<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Business Flow</title>
    <script src="/static/bflow/assets/js/scriptLib.js"></script>
    <script src="/static/bflow/assets/js/tableScriptLib.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#dataList').bootstrapTable({
                url: '/bflow/index/userList',
                search: true,
                maintainSelected: true,
                clickToSelect: true,
                showToggle: true,
                pagination: true,
                showRefresh: true,
                showColumns: true,
                onClickRow:function (row, $element) {
                    $($element).addClass('info');
                    $($element).siblings().removeClass('info');
                },
            });
        });
        function formatAction(value, row, index) {
            var str = '<a class="btn btn-primary btn-sm" onclick="login('+row.userId+')">模拟登录<a>';
            return str;
        }
        function login(userId){
            HttpUtil.ajaxAsyncJsonPost("/bflow/index/login", {userId: userId}, function(msg){
                dialogTipSuccess(msg);
                refreshPage(1000);
            });
        }

        setTimeout(function () {
            loadUserInfo();
        }, 500);
        function loadUserInfo(){
            HttpUtil.ajaxAsyncJsonPost("/bflow/index/getUserInfo", {}, function(data){
                $("#currUserName").text(data.userBo.userName);
                $("#waitTaskCount").text(data.waitTaskCount);
            });
        }
    </script>
    <style type="text/css">
        .menu-list{background: #fbfbfb;}
    </style>
</head>
<body>
    <h3 align="center">欢迎使用BFlow</h3>
    <br>
    <div class="col-sm-8 col-sm-offset-2">
        <span class="help-block">流程定义:</span>
        <ul class="menu-list nav nav-pills nav-justified">
            <li><a href="/static/bflow/ui/define/actList.html">活动定义</a></li>
            <li><a href="/static/bflow/ui/define/processList.html">流程定义</a></li>
        </ul>
        <span class="help-block">案例:</span>
        <ul class="menu-list nav nav-pills">
            <li><a class="text-danger" href="/static/bflow/ui/example/startProcess.html">模拟客户端</a></li>
            <li><a href="/static/bflow/ui/example/neg/list.html">议标审批</a></li>
            <li><a href="/static/bflow/ui/example/leave/list.html">请假审批</a></li>
            <!--<li><a href="/static/bflow/ui/gtasks/gtasksList.html">我的待办</a></li>-->
            <li><a href="static/bflow/ui/myfFlow/myFlow.html">我的流程</a></li>
        </ul>
        <br>
        <h3>模拟登录 ,
            <small>当前登录用户:
            <span id="currUserName" class="text-danger"></span>
            , 待办任务数: <span id="waitTaskCount" class="text-primary">0</span>
            </small>
        </h3>
        <br>

        <table id="dataList" >
            <thead>
            <tr>
                <th data-field="userId">用户ID</th>
                <th data-field="userName">用户名</th>
                <th data-field="roleName">角色</th>
                <th data-field="tel">电话</th>
                <th data-formatter="formatAction" data-searchable="false">操作</th>
            </tr>
            </thead>
            <tbody></tbody>
        </table>
    </div>

</body>
</html>